<template>
    <div class="demo-collapse">
        <el-collapse v-model="activeNames" @change="handleChange">
            <el-collapse-item title="问题描述" name="des">
                <div class="detail">
                    <img class="image" src="../../../../../assets/最长公共子序列/LCCS2.png">
                    <div class="detail-text">
                        <div class="text">
                            最长公共子序列是指两个序列中最长的子序列，且两个子序列在原序列中的顺序都是一致的，
                            但不一定连续。最长公共子序列就是在两个序列中，找出能够匹配的最长子序列。
                        </div>
                        <el-table :data="tableData" border style="width: 99%;">
                            <el-table-column prop="name" label="名称" />
                            <el-table-column prop="time" label="时间复杂度" />
                            <el-table-column prop="spatial" label="空间复杂度" />
                        </el-table>
                    </div>
                </div>
            </el-collapse-item>
            <el-collapse-item title="相关研究" name="3">
                <ul>
                    <li v-for="item in thesisData" :key="item.title">
                        <a :href="item.link" target="_blank">
                            <div class="thesis">
                                <img class="thesis-cover" src="../../../../../icons//thesis.svg" alt="">
                                <div class="thesis-title">
                                    {{ item.title }}
                                </div>
                                <div class="thesis-author">
                                    <span>作者：</span>{{ item.author }}
                                </div>
                                <div class="thesis-time">
                                    <span>时间：</span>{{ item.time }}
                                </div>
                                <div class="thesis-source">
                                    <span>来源：</span>{{ item.source }}
                                </div>
                            </div>
                        </a>
                    </li>
                </ul>
            </el-collapse-item>
            <el-collapse-item title="应用场景" name="4">
                <div class="detail">
                    <img class="use" src="../../../../../assets/最长公共子序列/LCCS.png" alt="">
                    <div class="text">
                        最长公共子序列问题是一个经典的计算机科学问题，也是数据比较程序，比如Diff工具，
                        和生物信息学应用的基础。它也被广泛地应用在版本控制，比如Git用来调和文件之间的改变。
                    </div>
                </div>
            </el-collapse-item>
        </el-collapse>
    </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
const activeNames = ref(['1'])
const handleChange = (val: string[]) => {
    console.log(val)
}

// 相关研究部分
const thesisData = [
    {
        title: "求解最长循环公共子序列问题的两个算法",
        author: "郑子君，王洪，余成",
        time: "2020年",
        source: "百度学术",
        link: "https://xueshu.baidu.com/usercenter/paper/show?paperid=1m420jj05x3t0ah0gg1g0vw0ww670576&site=xueshu_se",
    },
    {
        title: "最长公共子序列算法的分析与实现",
        author: "郑翠玲",
        time: "2010年",
        source: "百度学术",
        link: "https://xueshu.baidu.com/usercenter/paper/show?paperid=c11cada0b840a5c27a742c18a4aa1486&site=xueshu_se",
    },
    {
        title: "求最长公共子序列问题的一种快速算法",
        author: "刘佳梅",
        time: "2010年",
        source: "百度学术",
        link: "https://xueshu.baidu.com/usercenter/paper/show?paperid=b6da58913a550e92931476001e24f851&site=xueshu_se",
    },

]

// 复杂度表格描述
const tableData = [
    {
        name: '最长公共子序列',
        time: 'O(nm)',
        spatial: 'O(n+m)',
    },
]

</script>

<style scoped lang="scss">
* {
    list-style: none;
}

.image {
    width: 290px;
    border-radius: 10px;
    margin-right: 10px;
}

a {
    text-decoration: none;
    /* 去除默认的下划线 */
    outline: none;
    /* 去除旧版浏览器的点击后的外虚线框 */
    color: #000;
    /* 去除默认的颜色和点击后变化的颜色 */
}

.detail {
    display: flex;
    justify-content: center;
    align-items: end;

    .detail-box {
        display: flex;
        flex-direction: column;
    }

    .text {
        margin-left: 10px;
        margin-bottom: 10px;
        cursor: default;
    }

    .use {
        width: 240px;
        height: 150px;
        border-radius: 10px;
    }
}

// 相关研究部分
.thesis {
    width: 98%;
    position: relative;
    left: 20px;
    margin-bottom: 10px;
    font-weight: normal;
    background: #F5F5F5;
    border-radius: 10px;
    transition: all 0.2s linear;

    .thesis-title {
        position: absolute;
        top: 0;
        left: 5px;
    }

    .thesis-author {
        position: absolute;
        top: 25px;
        left: 120px;
    }

    .thesis-time {
        position: absolute;
        top: 45px;
        left: 120px;
    }

    .thesis-source {
        position: absolute;
        top: 65px;
        left: 120px;
    }

    &:hover {
        cursor: pointer;
        transform: translateX(-15px);
    }
}
</style>